package order.dao;

import java.util.List;

import order.model.OpenTable;
import order.model.OrderItem;

import common.bean.PageInfo;
import common.exception.DataAccessException;

public interface IOrderDAO
{
	/**
	 * save a order of a table
	 * @param openTable order entity
	 * return order id
	 * @throws DataAccessException
	 */
	public int saveOpenTable(OpenTable openTable) throws DataAccessException;
	
	public void updateOpenTable(OpenTable openTable) throws DataAccessException;
	
	/**
	 * save order items
	 * @param orderItems
	 * @throws DataAccessException
	 */
	public void saveOrderItems(List<OrderItem> orderItems) throws DataAccessException;
	
	/**
	 * get a order by order Id
	 * @param orderId
	 * @return
	 * @throws DataAccessException
	 */
	public OpenTable getOpenTable(int orderId) throws DataAccessException;
	
	/**
	 * load order items by order Id
	 * @param orderId
	 * @return
	 * @throws DataAccessException
	 */
	public List<OrderItem> getOrderItems(int orderId) throws DataAccessException;
	
	public void deleteOpenTable(int orderId) throws DataAccessException;
	
	public void deleteOrderItems(int orderId) throws DataAccessException;
	
	public void deleteOrderItems(List<OrderItem> orderItems) throws DataAccessException;
	
	/**
	 * list openTable records base on the given page index and count
	 * @param page specify which page will be retrieved.
	 * @return
	 * @throws DataAccessException
	 */
	public List<OpenTable> list(PageInfo page) throws DataAccessException;
}
